//
//  MNDFirstDetailCell.m
//  minidai
//
//  Created by 谭谭伟 on 17/5/22.
//  Copyright © 2017年 迷你金服. All rights reserved.
//

#import "MNDFirstDetailCell.h"

@implementation MNDFirstDetailCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
//    [self.goInvestButton jk_setBackgroundColor:kColorOrange forState:UIControlStateNormal];
//    [self.goInvestButton setBackgroundImage:[[UIImage imageNamed:@"corner_btn"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 5, 0, 5)] forState:UIControlStateNormal];
//    self.goInvestButton.layer.cornerRadius = 20.0;
//    self.goInvestButton.clipsToBounds = YES;
    
    [self setupUI];
}

- (void)setCreditorsModel:(MNDCreditorsModel *)creditorsModel {
    _creditorsModel = creditorsModel;
    [self configContents];
}

- (void)setFirstFinanceModel:(MNDFinanceDateModel *)firstFinanceModel {
    _firstFinanceModel = firstFinanceModel;
    [self configFinanceContents];
}
- (void)configContents {

    self.titleLabel.text = self.creditorsModel.title;
    self.moneyLabel.text = [NSString stringWithFormat:@"剩余%@元", self.creditorsModel.remainingable_tender ];
    self.yearAprLabel.text = self.creditorsModel.year_apr;
    self.circleView.progress = self.creditorsModel.nowProgress * 0.01;
    self.deadlineLabel.text = self.creditorsModel.deadline;
    self.statusLabel.text = self.creditorsModel.txt_status;
    self.creditorIDButton.hidden = NO;
}

- (void)configFinanceContents {
    self.titleLabel.text = self.firstFinanceModel.title;
    self.moneyLabel.text = [NSString stringWithFormat:@"剩余%@元", self.firstFinanceModel.remainingable_tender ];
    self.yearAprLabel.text = self.firstFinanceModel.year_apr;
    self.circleView.progress = self.firstFinanceModel.nowProgress * 0.01;
    self.deadlineLabel.text = self.firstFinanceModel.deadline;
    self.statusLabel.text = self.firstFinanceModel.txt_status;
    //隐藏债权标识
    self.creditorIDButton.hidden = YES;

}


//- (void)goInvestAction:(UIButton *)sender {
//    if (sender.tag == 101) {
//        
//    }
//
//}
//
//- (void)goFinanceInvestAction:(UIButton *)sender {
//    if (sender.tag == 102) {
//        
//    }
//}
#pragma mark -搭建界面

- (void)setupUI {
    ZZCircleProgress *progressView = [[ZZCircleProgress alloc]initWithFrame:CGRectMake(0, 0, 50, 50) pathBackColor:[UIColor colorWithRed:220/255.0 green:220/255.0 blue:220/255.0 alpha:1.0] pathFillColor:[UIColor colorWithRed:78/255.0 green:140/255.0 blue:238/255.0 alpha:1.0] startAngle:0 strokeWidth:1];
    progressView.startAngle = -90;
    progressView.showPoint = NO;
    progressView.animationModel = CircleIncreaseSameTime;
    //    progressView.progress = 0.6;
    [self.progressView addSubview:progressView];
    self.circleView = progressView;
    
    self.shadowView.layer.cornerRadius = 20.0;
    self.shadowView.layer.shadowOpacity = 0.6;
    self.shadowView.layer.shadowOffset = CGSizeMake(1.0, 3.0);
    self.shadowView.layer.shadowRadius = 4.0;
    self.shadowView.layer.shadowColor = kColorOrange.CGColor;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
